package com.wisdom.view;


import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

import com.wisdom.DialActivity;
import org.sipdroid.sipua.R;
import org.sipdroid.sipua.ui.Sipdroid;

import com.wisdom.tools.CCPConfig;
import com.wisdom.view.adapter.HomeSettingAdapter;

public class HomeSettingActivity extends Activity {
	private ListView moreList;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.home_setting_page);
		moreList=(ListView) findViewById(R.id.more_list);
		HomeSettingAdapter adapter=new HomeSettingAdapter(this);
		moreList.setAdapter(adapter);
		moreList.setOnItemClickListener(new OnItemClickListener() {//为每一个item设置相应的响应  
		public void onItemClick(AdapterView<?> parent, View view,
		        int position, long id) {
				Uri uri;
				Intent it;
                switch(position){  
                case 0: //账户管理
                	startActivity(new Intent(HomeSettingActivity.this,SettingMyAccount.class));
                    break;  
                case 1://我要充值
                	  uri = Uri.parse(CCPConfig.Mobile_BasicUrl+"/paymobile/"+CCPConfig.UserId);  
                	  it = new Intent(Intent.ACTION_VIEW, uri);  
                	 startActivity(it);
                	//startActivity(new Intent(HomeSettingActivity.this,settingPaymentActivity.class));  
                	break;
                case 2:  
                    //分享  
                    Intent intent=new Intent(Intent.ACTION_SEND);  
                    intent.setType("text/plain");  
                    intent.putExtra(Intent.EXTRA_SUBJECT, "分享");  
                    intent.putExtra(Intent.EXTRA_TEXT, "我要推荐给你可以挣钱的网络电话:"+CCPConfig.Mobile_BasicUrl+"/go/"+CCPConfig.UserId);  
                    startActivity(Intent.createChooser(intent, getTitle()));  
                    break;  
                case 3: //拨打设置
                	startActivity(new Intent(HomeSettingActivity.this,DialSettingActivity.class));
                    break;  
                case 4:  
                    //帮助  
                    //startActivity(new Intent(HomeSettingActivity.this,HelpActivity.class));  
                	 uri = Uri.parse(CCPConfig.Mobile_BasicUrl+"/help/"+CCPConfig.UserId);  
                	 it = new Intent(Intent.ACTION_VIEW, uri);  
                	 startActivity(it);
                    break;  
                case 5:  
                    //意见反馈  
                  //  AppConnect.getInstance(MoreActivity.this).showFeedback(); 
                	 uri = Uri.parse(CCPConfig.Mobile_BasicUrl+"/feedback/"+CCPConfig.UserId);  
                	 it = new Intent(Intent.ACTION_VIEW, uri);  
                	 startActivity(it);
                    break;  
                case 6://退出  
                 //   AlertDlgUtil.AlertExit(MoreActivity.this);  
                	CCPConfig.setConfigProperties("accesstoken", "");
                	android.os.Process.killProcess(android.os.Process.myPid());
                    break;  
                case 7:
                	startActivity(new Intent(HomeSettingActivity.this,Sipdroid.class));
                	//startActivity(new Intent(HomeSettingActivity.this,DialActivity.class));
                	break;
                }
                
                
            }  
        });  
	}
}
